package com.example.plan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 运输风险预警表
 * @TableName risk_alert
 */
@TableName(value ="risk_alert")
@Data
public class RiskAlert implements Serializable {
    /**
     * 预警ID
     */
    @TableId(value = "alert_id", type = IdType.AUTO)
    private Long alert_id;

    /**
     * 关联订单ID
     */
    @TableField(value = "order_id")
    private Long order_id;

    /**
     * 风险类型
     */
    @TableField(value = "risk_type")
    private Object risk_type;

    /**
     * 风险等级
     */
    @TableField(value = "risk_level")
    private Object risk_level;

    /**
     * 建议措施（如更换无人机或延迟运输）
     */
    @TableField(value = "suggestion")
    private String suggestion;

    /**
     * 触发时间
     */
    @TableField(value = "triggered_at")
    private Date triggered_at;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        RiskAlert other = (RiskAlert) that;
        return (this.getAlert_id() == null ? other.getAlert_id() == null : this.getAlert_id().equals(other.getAlert_id()))
            && (this.getOrder_id() == null ? other.getOrder_id() == null : this.getOrder_id().equals(other.getOrder_id()))
            && (this.getRisk_type() == null ? other.getRisk_type() == null : this.getRisk_type().equals(other.getRisk_type()))
            && (this.getRisk_level() == null ? other.getRisk_level() == null : this.getRisk_level().equals(other.getRisk_level()))
            && (this.getSuggestion() == null ? other.getSuggestion() == null : this.getSuggestion().equals(other.getSuggestion()))
            && (this.getTriggered_at() == null ? other.getTriggered_at() == null : this.getTriggered_at().equals(other.getTriggered_at()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAlert_id() == null) ? 0 : getAlert_id().hashCode());
        result = prime * result + ((getOrder_id() == null) ? 0 : getOrder_id().hashCode());
        result = prime * result + ((getRisk_type() == null) ? 0 : getRisk_type().hashCode());
        result = prime * result + ((getRisk_level() == null) ? 0 : getRisk_level().hashCode());
        result = prime * result + ((getSuggestion() == null) ? 0 : getSuggestion().hashCode());
        result = prime * result + ((getTriggered_at() == null) ? 0 : getTriggered_at().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", alert_id=").append(alert_id);
        sb.append(", order_id=").append(order_id);
        sb.append(", risk_type=").append(risk_type);
        sb.append(", risk_level=").append(risk_level);
        sb.append(", suggestion=").append(suggestion);
        sb.append(", triggered_at=").append(triggered_at);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}